import type { AppStorage } from 'my-ts-core/storage';

export class MemoryStorage implements AppStorage {
  private store: Record<string, any> = {};

  set(key: string, value: any): void {
    this.store[key] = value;
  }

  get(key: string): any {
    return this.store[key] ?? null;
  }

  exists(key: string): boolean {
    return this.store[key] !== undefined;
  }

  remove(key: string): void {
    delete this.store[key];
  }
}
